﻿<navigation:Page x:Class="LEEAAttendanceControl.Views.Users" 
           xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
           xmlns:toolkit="http://schemas.microsoft.com/winfx/2006/xaml/presentation/toolkit"
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices"
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           xmlns:my="clr-namespace:LEEAAttendanceControl.Web.Services"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="Users">
    <Grid x:Name="LayoutRoot">
        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <StackPanel Orientation="Vertical">
                <riaControls:DomainDataSource x:Name="UsersDataSource" QueryName="GetUserSummaries" AutoLoad="True"
                                              PageSize="10" LoadSize="20" LoadingData="UsersDataSource_LoadingData">
                    <riaControls:DomainDataSource.DomainContext>
                        <my:LEEAContext/>
                    </riaControls:DomainDataSource.DomainContext>
                </riaControls:DomainDataSource>

                <Grid Background="#404041">
                    <TextBlock HorizontalAlignment="Left" Text="Users" FontSize="14" FontWeight="Bold" Foreground="White"
                               Margin="5,3,2,2"/>
                </Grid>
                
                <sdk:DataGrid x:Name="UsersGrid" AutoGenerateColumns="False" IsReadOnly="True"
                              ItemsSource="{Binding Data, ElementName=UsersDataSource}">
                    <sdk:DataGrid.Columns>
                        <sdk:DataGridTemplateColumn Header="First Name" CanUserReorder="True" CanUserResize="True"
                                                    Width="130">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <sdk:Label x:Name="FirstNameLabel" Margin="5,0,0,0" VerticalAlignment="Center"
                                               Height="25" Content="{Binding FirstName}"/>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn Header="Last Name" CanUserReorder="True" CanUserResize="True"
                                                    Width="130">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <sdk:Label x:Name="LastNameLabel" Margin="5,0,0,0" VerticalAlignment="Center"
                                               Content="{Binding LastName}"/>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn Header="Role" CanUserReorder="True" CanUserResize="True"
                                                    Width="160">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <sdk:Label x:Name="RoleLabel" Margin="5,0,0,0" VerticalAlignment="Center"
                                               Content="{Binding Role}"/>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn Header="Company" CanUserReorder="True" CanUserResize="True"
                                                    Width="140">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <sdk:Label x:Name="CompanyLabel" Margin="5,0,0,0" VerticalAlignment="Center"
                                               Content="{Binding Company}"/>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridTemplateColumn Header="Department" CanUserReorder="True" CanUserResize="True"
                                                    Width="140">
                            <sdk:DataGridTemplateColumn.CellTemplate>
                                <DataTemplate>
                                    <sdk:Label x:Name="DepartmentLabel" Margin="5,0,0,0" VerticalAlignment="Center"
                                               Content="{Binding Department}"/>
                                </DataTemplate>
                            </sdk:DataGridTemplateColumn.CellTemplate>
                        </sdk:DataGridTemplateColumn>
                        <sdk:DataGridCheckBoxColumn Header="Active" Binding="{Binding Active}" Width="83"/>
                    </sdk:DataGrid.Columns>
                </sdk:DataGrid>

                <sdk:DataPager x:Name="UsersPager" PageSize="10" Source="{Binding Data, ElementName=UsersDataSource}"/>
            </StackPanel>
        </ScrollViewer>
    </Grid>
</navigation:Page>
